﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using XGameFrame;
using XGameFrame.Controls;

namespace XTowerDef.GameScreens.GamePlayElements
{
    public class FpsCounter:Label
    {
        public FpsCounter(Vector2 pPosition)
            : base(pPosition)
        {
            Text = "0";
            Size = getSizeForText(Text);
            Bounds = new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y);
            //UpdateBoundPositions();
        }

        public override void Update(GameTime gameTime)
        {
            Text = "FPS: "+Math.Round((decimal)1 / (decimal)gameTime.ElapsedGameTime.TotalSeconds,1).ToString();
            Size = getSizeForText(Text);
            Bounds = new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y);
            base.Update(gameTime);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
        }

    }
}
